<?php

class MigrateController extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->library('migration');
    }

    public function current()
    {
        $this->db->trans_start();
        if (false === $this->migration->current())
        {
            return show_error($this->migration->error_string());
        }
        $this->db->trans_complete();
    }

    public function lastest()
    {
        $this->db->trans_start();
        if (false === $this->migration->latest()) {
            return show_error($this->migration->error_string());   
        }
        $this->db->trans_complete();
    }

    public function version($version = 0)
    {
        $this->db->trans_start();
        if (false === $this->migration->version($version)) {
            return show_error($this->migration->error_string());   
        }
        $this->db->trans_complete();
    }
}